<?php

class frmLogin extends FForm
{
    
    public function __construct()
    {
        parent::__construct('frmLogin');
        $this->model = 'login';
    }
    
    public function generate($show)
    {
        $this->title = 'Login';
        $this->height = 300;
        $this->width = 400;
        $this->showBottomBar = false;
        $this->closable = false;
        $this->draggable = false;
        $this->formFunction = 'login';
        
        $img = new FImage('loginImage', 'themes/default/images/imgLogin.png');
        $img->setHeight(128);
        $img->setWidth(128);
        $img->setMarginLeft(round(($this->getWidth() - $img->getWidth())/2));
        $img->setMarginTop(-20);
        $img->setMarginBottom(10);
        $this->addFormField($img);
        
        $fldLogin = new FTextField('usuario', 'Usuário', 60);
        $fldLogin->setRequired(true);
        $fldLogin->setOnKeyDown(13, FUtil::getFormSubmitAction($this->getName()), $this->getName());
        $this->addFormField($fldLogin);
        
        $fldSenha = new FPasswordField('senha', 'Senha', 60);
        $fldSenha->setRequired(true);
        $fldSenha->setOnKeyDown(13, FUtil::getFormSubmitAction($this->getName()), $this->getName());
        $this->addFormField($fldSenha);
        
        /*$fldPessoa = new FLookup('cod_pessoa', 'Pessoa', 'codigo', 'nome');
        $fldPessoa->setTable('pessoas');
        $fldPessoa->setRequired(true);
        $fldPessoa = new FSelection('cod_pessoa', 'Pessoa', 'codigo', 'nome');
        $fldPessoa->setTable('pessoas');
        $this->addFormField($fldPessoa);*/
        
        $btnLogin = new FButton('btnLogin', 'Login', 'login');
        $btnLogin->setIcon('themes/default/images/botao_entrar.png');
        $btnLogin->setIconAlign(FButton::ICON_ALIGN_LEFT);
        
        /*$btnCancelar = new FButton('btnCancelar', 'Cancelar');
        $btnCancelar->setHandler(FUtil::getFormCloseAction());*/
        
        $this->setFormButtons(array($btnLogin));
        
        parent::generate($show);
    }
        
}

?>
